#include <bits/stdc++.h>
using namespace std;

int n, l, r;

int main()
{
	freopen("candy.in", "r", stdin);
	freopen("candy.out", "w", stdout);
	
	scanf("%d%d%d", &n, &l, &r);
	
	int mn = l / n * n;
	
	if (r - mn >= n - 1)
		printf("%d", n - 1);
	else
		printf("%d", r - mn);
		
	return 0;
} 
